<%@ page language="java" pageEncoding="UTF-8"%>
<script type="text/javascript">
	var certificateDatagrid;
	var certificateStudentDatagrid;
	$(function() {
		certificateDatagrid = $('#student_certificateList_datagrid').datagrid({
			url : '${pageContext.request.contextPath}/certificateAction!queryCertificate.action',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10, 20 ],
			checkOnSelect : true,
			selectOnCheck : true,
			singleSelect : true,
			striped : true,
			columns : [ [ {
				field : 'id',
				title : '编号',
				width : 80,
				checkbox : true
			}, {
				field : 'studentName',
				title : '姓名',
				width : 80
			}, {
				field : 'studentNo',
				title : '学号',
				width : 80
			}, {
				field : 'finishFlag',
				title : '是否毕业代码',
				width : 100,
				hidden : true
			}, {
				field : 'finishFlagName',
				title : '是否毕业',
				width : 100,
				align : 'left'
			}, {
				field : 'certificateName',
				title : '证书名称',
				width : 150,
				align : 'left'
			}, {
				field : 'drawMethod',
				title : '领取方式',
				width : 100,
				hidden : true
			}, {
				field : 'drawMethodName',
				title : '领取方式',
				width : 100,
				align : 'left'
			}, {
				field : 'drawPerson',
				title : '代领人',
				width : 100,
				align : 'left'
			}, {
				field : 'memo',
				title : '备注',
				width : 150,
				align : 'left',
			} ] ],
			toolbar : [ {
				text : '查询',
				iconCls : 'icon-search',
				handler : function() {
					queryCertificate();
				}
			}]
		});
		
		$('.datagrid-header div').css({
			'textAlign' : 'center'
		});

		function queryCertificate() {
			$('#student_certificateList_queryForm input').val('');
			$('#student_certificateList_queryDialog').dialog('open');
		}
	});

	function openStudentDialog() {
		$('#student_certificateList_studentDialog').dialog('open');
		certificateStudentDatagrid = $('#student_certificateList_studentDatagrid').datagrid({
			url : '${pageContext.request.contextPath}/studentAction!queryStudent.action',
			fit : true,
			fitColumns : true,
			border : false,
			pagination : true,
			striped : true,
			idField : 'id',
			pageSize : 10,
			pageList : [ 10 ],
			sortName : 'studentName',
			sortOrder : 'asc',
			checkOnSelect : true,
			selectOnCheck : true,
			singleSelect : true,
			columns : [ [ {
				field : 'studentName',
				title : '姓名',
				width : 100,
				sortable : true
			}, {
				field : 'studentNo',
				title : '学号',
				width : 100,
				sortable : true
			}, {
				field : 'title',
				title : '职称',
				width : 100,
				align : 'center',
				hidden : true
			}, {
				field : 'corporationName',
				title : '工作单位',
				width : 150,
				align : 'center'
			}, {
				field : 'position',
				title : '职务',
				width : 100,
				align : 'center'
			}, {
				field : 'mobile',
				title : '手机',
				width : 100,
				align : 'center'
			}, {
				field : 'QQ',
				title : 'qq',
				width : 100,
				align : 'center'
			}, {
				field : 'email',
				title : '电子邮件',
				width : 100,
				align : 'center'
			} ] ],
			toolbar : '#student_certificateList_studentToolbar',
			onDblClickRow : function(rowIndex, rowData) {
				$('#student_certificateAdd_addCertificateForm input[name=studentName]').val(rowData.studentName);
				$('#student_certificateAdd_addCertificateForm input[name=studentNo]').val(rowData.studentNo);
				$('#student_certificateAdd_addCertificateForm input[name=studentId]').val(rowData.id);
				$('#student_certificateList_studentDialog').dialog('close');
			}
		});
		certificateStudentDatagrid.datagrid('unselectAll');
		certificateStudentDatagrid.datagrid('uncheckAll');
	}

	function queryStudent() {
		certificateStudentDatagrid.datagrid('load', serializeObject($('#student_certificateList_queryStudentForm')));
	}
</script>
<div id="student_paperList_layout" class="easyui-layout" data-options="fit:true,border:false">
	<div data-options="region:'center',border:false">
		<table id="student_certificateList_datagrid"></table>
	</div>
</div>
<div id="student_certificateList_queryDialog" class="easyui-dialog" data-options="title:'学生查询',closed:true,modal:true,
			buttons:[{
				text : '查询',
				handler : function(){
					$('#student_certificateList_datagrid').datagrid('load', serializeObject($('#student_certificateList_queryForm')));
				    $('#student_certificateList_queryDialog').dialog('close');
				}
			},{
				text : '清空',
				handler : function(){
					$('#student_certificateList_queryForm input').val('');
				}
			}]" style="width:380px;height:180px;padding:20px 20px;" align="center">
	<form id="student_certificateList_queryForm" method="post">
		<table>
			<tr>
				<td style="text-align: right;">姓名：</td>
				<td><input name="studentName" style="width: 240px;" /></td>
			</tr>
			<tr>
				<td style="text-align: right;">学号：</td>
				<td><input name="studentNo" style="width: 240px;" /></td>
			</tr>
		</table>
	</form>
</div>
<div id="student_certificateList_studentDialog" class="easyui-dialog" data-options="title:'学生查询',closed:true,modal:true" style="width:800px;height:500px;">
	<div id="student_paperList_studentLayout" class="easyui-layout" data-options="fit:true,border:false">
		<div data-options="region:'center',border:false">
			<table id="student_certificateList_studentDatagrid"></table>
		</div>
	</div>
</div>
<div id="student_certificateList_studentToolbar" style="height:60px;padding:5px 0 0 20px;">
	<form id="student_certificateList_queryStudentForm" method="post">
		<table>
			<tr>
				<td style="text-align: right;">姓名：</td>
				<td><input name="studentName" style="width:200px;" /></td>
			</tr>
			<tr>
				<td style="text-align: right;">学号：</td>
				<td><input name="studentNo" style="width:200px;" />&nbsp;&nbsp; <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="queryStudent()">查询</a></td>
			</tr>
		</table>
	</form>
</div>